package edu.scdx.service;
import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import edu.scdx.dao.CartMapper;
import edu.scdx.dao.UserInfoMapper;
import edu.scdx.entity.Cart;

@Service
public class CartServiceImpl implements CartService{
	
	@Autowired
    private CartMapper cartMapper;

	public CartMapper getCartMapper() {
		return cartMapper;
	}

	public void setCartMapper(CartMapper cartMapper) {
		this.cartMapper = cartMapper;
	}

	@Override
	public Cart getCart(String userTel, int id) {
		// TODO Auto-generated method stub
		Cart cart=cartMapper.getCart(userTel,id);
		return cart;
	}

	

	@Override
	public void updateCart(String userTel, int id) {
		// TODO Auto-generated method stub
		cartMapper.updateCart(userTel,id);
		
	}

	@Override
	public List<Cart> getAll(String userTel) {
		
		return cartMapper.getAll(userTel);
		
	}

	@Override
	public void addCart(String userTel, int id, int number, String name, String type, String author, String publisher,
			String description, double price, double kou) {
		cartMapper.addCart(userTel, id, number,name,type,author,publisher,description,price,kou);
		
	}

	@Override
	public void deleteCart(String tel, Integer id) {


		cartMapper.deleteCart(tel,id);
		
	}

	@Override
	public Cart getCartNumber(String tel, Integer id) {
		
		return cartMapper.getCartNumber(tel,id);
		
	}

	@Override
	public void updateCartNumber(String tel, Integer id) {
		
		cartMapper.updateCartNumber(tel,id);
		
	}

	
	

}
